package com.linyu.mallchat.common.user.service.impl;

import com.linyu.mallchat.common.user.dao.UserDao;
import com.linyu.mallchat.common.user.domain.entity.User;
import com.linyu.mallchat.common.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    /**
     * 用户注册
     *
     * @param newUser
     * @return
     */
    @Transactional
    @Override
    public Long register(User newUser) {
        userDao.save(newUser);
        // todo 用户注册的事件
        return newUser.getId();
    }
}
